#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
using namespace std;
class Solution
{
public:
    int max_val_decision(vector<int> &nums, int l, int r, int sum);
    int min_val_decision(vector<int> &nums, int l, int r, int sum);
    bool PredictTheWinner(vector<int> &nums)
    {
        int total = 0;
        for (auto &it : nums)
        {
            total += it;
        };
        if (max_val_decision(nums, 0, nums.size() - 1, 0) * 2 >= total)
            return true;
        return false;
    }
};
int Solution::max_val_decision(vector<int> &nums, int l, int r, int sum)
{
    if (l > r)
        return sum;
    sum = max(min_val_decision(nums, l + 1, r, sum + nums[l]),
              min_val_decision(nums, l, r - 1, sum + nums[r]));
    return sum;
}
int Solution::min_val_decision(vector<int> &nums, int l, int r, int sum)
{
    if (l > r)
        return sum;
    sum = min(max_val_decision(nums, l + 1, r, sum),
              max_val_decision(nums, l, r - 1, sum));
    return sum;
}
int main()
{
    Solution solver;
    vector<int> &nums = *new vector<int>;
    nums.push_back(1);
    nums.push_back(1);
    nums.push_back(1);
    printf("%d", solver.max_val_decision(nums, 0, nums.size() - 1, 0));
}